package com.sugar.follow.up.module.business.dal.mysql.questionnairequestionrecord;

import java.util.*;

import com.sugar.follow.up.framework.common.pojo.PageResult;
import com.sugar.follow.up.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.sugar.follow.up.framework.mybatis.core.mapper.BaseMapperX;
import com.sugar.follow.up.module.business.dal.dataobject.questionnairequestionrecord.QuestionnaireQuestionRecordDO;
import org.apache.ibatis.annotations.Mapper;
import com.sugar.follow.up.module.business.controller.admin.questionnairequestionrecord.vo.*;

/**
 * 问卷发起答题记录 Mapper
 *
 * @author Ysugar
 */
@Mapper
public interface QuestionnaireQuestionRecordMapper extends BaseMapperX<QuestionnaireQuestionRecordDO> {

    default PageResult<QuestionnaireQuestionRecordDO> selectPage(QuestionnaireQuestionRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<QuestionnaireQuestionRecordDO>()
                .eqIfPresent(QuestionnaireQuestionRecordDO::getRecordId, reqVO.getRecordId())
                .eqIfPresent(QuestionnaireQuestionRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(QuestionnaireQuestionRecordDO::getQuestionId, reqVO.getQuestionId())
                .likeIfPresent(QuestionnaireQuestionRecordDO::getTitle, reqVO.getTitle())
                .eqIfPresent(QuestionnaireQuestionRecordDO::getType, reqVO.getType())
                .betweenIfPresent(QuestionnaireQuestionRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(QuestionnaireQuestionRecordDO::getId));
    }

}